package com.woniu.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 预约表
 * @TableName reservation
 */
@TableName(value ="reservation")
@Data
public class Reservation implements Serializable {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 充电桩id
     */
    private Long chargerId;

    /**
     * 预约时长
     */
    private Integer reservationDuration;

    /**
     * 预约开始时间
     */
    private Date reservationStartTime;

    /**
     * 客户id
     */
    private Long customerId;

    /**
     * 状态
     */
    private Integer status;

    /**
     * 描述
     */
    private String description;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Reservation other = (Reservation) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getChargerId() == null ? other.getChargerId() == null : this.getChargerId().equals(other.getChargerId()))
            && (this.getReservationDuration() == null ? other.getReservationDuration() == null : this.getReservationDuration().equals(other.getReservationDuration()))
            && (this.getReservationStartTime() == null ? other.getReservationStartTime() == null : this.getReservationStartTime().equals(other.getReservationStartTime()))
            && (this.getCustomerId() == null ? other.getCustomerId() == null : this.getCustomerId().equals(other.getCustomerId()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getChargerId() == null) ? 0 : getChargerId().hashCode());
        result = prime * result + ((getReservationDuration() == null) ? 0 : getReservationDuration().hashCode());
        result = prime * result + ((getReservationStartTime() == null) ? 0 : getReservationStartTime().hashCode());
        result = prime * result + ((getCustomerId() == null) ? 0 : getCustomerId().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", chargerId=").append(chargerId);
        sb.append(", reservationDuration=").append(reservationDuration);
        sb.append(", reservationStartTime=").append(reservationStartTime);
        sb.append(", customerId=").append(customerId);
        sb.append(", status=").append(status);
        sb.append(", description=").append(description);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}